home *** CD-ROM | disk | FTP | other *** search
- //
- // This class includes everything I need to take care of the window.
- // A window is to be read in from a DLOG resource, and the
- // member "the_window" is actually the resulting DialogPtr,
- // although in truth DialogPtr, WindowPtr, and GrafPtr are all
- // synonyms.
- // The data of the DLOG resource is assumed to be _non-recolcatable_,
- // which is the case when you call GetNewDialog.
- // The member "the_data" is a handle to whatever stuff needs to be stored
- // for this window. It's up to the den mother to decide how to use this,
- // and whether it should be relocatable or locked.
- // The creator calls GetNewDialog, which draws the window, so
- // the den mother does not normally need to draw the window in
- // response to the complete_window_created message, unless the
- // resource indicates it is invisible.
- // The creator automatically calls ParamText before drawing
- // the window.
- // When an update event is received, the program's main event loop
- // should erase the contents of the window, call DrawControls,
- // and then call the den mother with a "whassup" of complete_window_action.
-
- enum complete_window_whassup {
- complete_window_created , //-- lets den mother know we just created it,
- // should initialize its data
- complete_window_redraw , //-- tells den mother to redraw it
- complete_window_action , //-- tells den mother to deal with an event
- complete_window_erase //-- tells den mother to get rid of
- // its data, and/or save its data to disk
- // because we're about to destroy it;
- // destructor will erase it from the screen,
- // den mother doesn't need to
- };
-
- class complete_window; // circular definition -- tell the compiler
- // I'll define this as a class later
- typedef void DEN_MOTHER_T(complete_window *);
-
- class complete_window {
- public:
-
- WindowPtr the_window;
- int is_valid;
- int resource_error;
- int is_drawn;
- int part_code; //-- inCheckBox, etc.; should be set by application's event
- // loop before calling den mother (use FindControl)
- int part_number; //-- should be set by application's event (use FindDItem)
- // loop before calling den mother
- complete_window_whassup whassup;
- EventRecord *the_event; //--for complete_window_action messages to the den mother
- Str255 param_text0; //--Pascal-style strings; see the toolbox routine ParamText
- Str255 param_text1;
- Str255 param_text2;
- Str255 param_text3;
- int has_den_mother; //--set to 1 by creator of den mother is not null
- DEN_MOTHER_T *den_mother;
- void **data_handle;
- void *data_pointer;
- int data_int;
- char *data_verb;
-
- complete_window::complete_window(
- int dlog_resource_id,
- Str255 the_param_text0,
- Str255 the_param_text1,
- Str255 the_param_text2,
- Str255 the_param_text3,
- DEN_MOTHER_T *den_mother);
- ~complete_window();
- };
-
-
-
- void part_number_to_nifty_label(
- char *nifty_name,
- int *nifty_index,
- char *decoder,
- int part_num);
- int nifty_label_to_part_number(char *nifty_name,int nifty_index,char *decoder);
- int substring_to_integer(char *string,int first,int last);
- int find_char_in_string(char *the_string,int first,
- int last,char the_char,int if_not_found);
- void get_rect_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string,Rect *rr);
- void set_ctl_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string,int value);
- void hide_ctl_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string);
- void show_ctl_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string);
- void get_item_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string,Handle *h);
- void refresh_text(complete_window *my_complete_window,
- char *nifty_label,int nifty_index,char *decoder_string);
- void activate_ctl_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string);
- void deactivate_ctl_by_nifty_label(WindowPtr w,char *nifty_label,int nifty_index,
- char *decoder_string);
- void message_to_den_mother(complete_window *the_complete_window,void **data_h,
- void *data_p,int data_i,char *data_v);
-